const app = getApp();
Page({
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,

  },
  onLoad: function (options) {
    // const db = wx.cloud.database();
    var that = this
    wx.request({
      url: getApp().globalData.url_database,
      method:'GET',
      data:{ 
        action:'car_history',
      },
      success: function(res)
        {
          console.log(res.data.retlist.length)
          for (let index = 0; index < res.data.retlist.length; index++) res.data.retlist[index].uploaddate=res.data.retlist[index].uploaddate.replace(/T/g, ' ').replace(/.[\d]{3}Z/, ' '),res.data.retlist[index].endtime=res.data.retlist[index].endtime.replace(/T/g, ' ').replace(/.[\d]{3}Z/, ' ');
          that.setData({
            log: res.data.retlist,
          })
        },        
    })  
    // db.collection('caruser').orderBy('uploaddate', 'desc').get({
    //   success: function(res) {
    //     that.setData({
    //       log: res.data,
    //     })
    //   },
    //   fail: function(event) { console.log("获取失败")}
    // })
   },

  
});
